package com.zzh.takeoutapp.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.RadioGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zzh.takeoutapp.R;
import com.zzh.takeoutapp.entity.OrderListBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/8/23.
 */

public class EvaluateItemAdapter extends BaseQuickAdapter<OrderListBean.ProductsBean, BaseViewHolder> {

    public Map<String, String> map = new HashMap<>();

    public EvaluateItemAdapter(@Nullable List<OrderListBean.ProductsBean> data) {
        super(R.layout.item_evaluate, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, final OrderListBean.ProductsBean item) {
        helper.setText(R.id.tv_product_name, item.getProduct_name());
        map.put(item.getProduct_name(), "1");
        ((RadioGroup) helper.getView(R.id.rg_shop)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rb_shop:
                        map.put(item.getProduct_id(), "1");
                        break;
                    case R.id.rb_shop_one:
                        map.put(item.getProduct_name(), "0");
                        break;
                }
            }
        });
    }
}
